package chapter07;

import java.sql.Connection;

public class PoolTest {
    public static void main(String[] args) {
        // 创建连接池
        Pool pool = new Pool(2);
        for(int i=1;i<=5;i++){
            new Thread(()->{
                Connection connection = pool.getConnection();
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                pool.free(connection) ;
            }).start();
        }
    }
}
